Skip to main content

AuthorizeSecurityGroup

Description

The call AuthorizeSecurityGroup adds an inbound security group rule. Specify the inbound access permission of the security group, and allow or deny other devices to send inbound traffic to instances in the security group.

Request Method

POST

Request Path

/apsara/route/Ecs/AuthorizeSecurityGroup

Request Parameters Common Parameters

NameLocationTypeRequiredSample valueDescription
SourceGroupIdBODYstringNosg-bp67acfmxazb4pj***the source security group ID that needs to set access rights. Set at least one SourceGroupId or SourceCidrIp parameter. if the specified SourceGroupId does not specify the parameter SourceCidrIp, the parameter NicType value can only be intranet. if both SourceGroupId and SourceCidrIp are specified, the SourceCidrIp shall prevail by default.
PolicyBODYstringNoacceptset access rights. Value range: accept (default): Accept access. drop: denied access and does not return a denial message, which is expressed as similar information that the initiator request timed out or cannot establish a connection.
DescriptionBODYstringNoManually authorize SSH 22 port-RuleDemodescription information of security group rules. The length is 1~512 characters.
SourcePortRangeBODYstringNo22/22the port range related to the transport layer protocol open by the source security group. Value range: TCP/UDP protocol: the value range is 1~65535. Use a slash (/) to separate the start and end ports. Correct demonstration: 1/200; Error demonstration: 200/1. ICMP protocol:-1/-1. GRE protocol:-1/-1. The IpProtocol value is all:-1/-1.
PriorityBODYstringNo1security group rule priority, the smaller the number, the higher the priority. Value range: 1~100 default value: 1.
SecurityGroupIdBODYstringYessg-bp67acfmxazb4ph***destination security group ID.
SourceGroupOwnerIdBODYlongNo155780923770When setting security group rules across accounts, the ID of the Alibaba Cloud account to which the source security group belongs. if the SourceGroupOwnerId and SourceGroupOwnerAccount are not set, it is considered to set the access rights of your other security groups. if you have set the parameter SourceCidrIp, the parameter SourceGroupOwnerId is invalid.
Ipv6SourceCidrIpBODYstringNo2001:250:6000::***source IPv6 CIDR address segment. Supports IP address ranges in CIDR format and IPv6 format. Description Only IPv6 addresses of VPC-type ECS instances are supported. Default value: None.
NicTypeBODYstringNointranetthe network card type of the classic network type security group rule. Value range: internet: public network card. intranet: intranet network card. VPC type security group rules do not need to set the network card type. The default value is intranet and can only be intranet. when setting mutual access between security groups, the DestGroupId is specified and no DestCidrIp is specified, which can only be intranet. default value: internet.
versionBODYstringNo2016-01-01version of api
PortRangeBODYstringYes22/22the port range related to the transport layer protocol open by the destination security group. Value range: TCP/UDP protocol: the value range is 1~65535. Use a slash (/) to separate the start and end ports. Correct demonstration: 1/200; Error demonstration: 200/1. ICMP protocol:-1/-1. GRE protocol:-1/-1. The IpProtocol value is all:-1/-1.
regionIdBODYstringYesNo sample value for this parameter.region id
SourceCidrIpBODYstringNo10.0.0.0/8source IPv4 CIDR address segment. CIDR format and IPv4 format are supported for IP address ranges. Default value: None.
IpProtocolBODYstringYesalltransport layer protocol. The value is case sensitive. Value range: tcp udp icmp gre all: supports all protocols description here icmp protocol only supports IPv4 addresses.
DestCidrIpBODYstringNo10.0.0.0/8destination IPv4 CIDR address segment. CIDR format and IPv4 format are supported for IP address ranges. Default value: None.
RegionIdBODYstringYescn-qingdao-env17-d01the region ID of the security group. You can call the DescribeRegions to view the latest Alibaba Cloud region list.
SourceGroupOwnerAccountBODYstringNotest@aliyun.comWhen setting security group rules across accounts, the Alibaba Cloud account to which the source security group belongs. if the SourceGroupOwnerAccount and SourceGroupOwnerId are not set, it is considered to set the access rights of your other security groups. if the parameter SourceCidrIp has been set, the parameter SourceGroupOwnerAccount is invalid.
Ipv6DestCidrIpBODYstringNo2001:250:6000::***destination IPv6 CIDR address segment. Supports IP address ranges in CIDR format and IPv6 format. Description Only IPv6 addresses of VPC-type ECS instances are supported. Default value: None.
ClientTokenBODYstringNo123e4567-e89b-12d3-a456-426655440000Ensure request idempotence. Generate a parameter value from your client to ensure that the parameter value is unique between different requests. ClientToken only supports ASCII characters and cannot exceed 64 characters. For more details, please refer to the section on how to ensure idempotence in the cloud server ECS development guide.

Return data

NameTypeSample valueDescription
RequestIDstring1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DCRequest id

Example

Successful Response example

{
"RequestID":"1E3D5A1E0-67CA-43DA-24BC-EAF2D5A1E4DC"
}

Failed Response example

{
"errorSample":
{
"resultCode":-1,
"resultMsg":"system error",
"result":null
}

}